package com.zr.dao.impl;

import java.util.List;

import org.hibernate.Query;
import org.springframework.stereotype.Repository;

import com.zr.dao.ShowLineDao;
import com.zr.model.Way;
@Repository("showlinedao")
public class ShowLineDaoImpl<T> extends BaseDaOImpl<T> implements ShowLineDao{
	
	
	@Override
	public List<Way> findLine(int page,int rows) {
		String hql="from Way";
		Query query = this.getCurrentSession().createQuery(hql);
		query.setFirstResult((page-1)*rows);// 起始位置
    	query.setMaxResults(rows);//记录数
		List<Way> list = query.list();
		return list;
	}

	@Override
	public long count() {
		String hql = "select count(*) from Way";
		List<Object>  obj = this.getCurrentSession().createQuery(hql).list();
		return (long)obj.get(0);
	}

}
